<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>项目进程-目的地运营集团数据管理平台</title>
<include file="Include:style" />
<link rel="stylesheet" href="__PUBLIC__/mobile/css/mobiscroll.min.css">
</head>
<body style="background: #f3f3f3;">
<div class="header">
	<div class="header">
		<a href="__APP__/Mobile/Crm/project_situation/id/{$project['project_id']}" class="back_btn"></a>
        项目进程
		<a class="menu_btn_new" href="javascript:;"><span class="sp1"></span><span class="sp2"></span><span class="sp3"></span></a>
    </div>
</div>
<include file="Include:crm_commu_menu" />
<div class="content">
    <div class="communicate_add" style="padding-bottom:64px;">
        <form name="number_validate">
            <div class="data paddbox">
                <div><input type="text" id="data" name="visit_date" readonly value="拜访日期"></div>
            </div>
            <form>
            <div class="form_item">
                <div class="form_item_tit">
                    工作类别
                </div>
				<div class="form_item_box label_box">
					<label class="form_label w50b checkbox"><input type="checkbox" name="work_type[]" value="4">前期沟通</label>
					<label class="form_label w50b checkbox"><input type="checkbox" name="work_type[]" value="1">工作建议书</label>
					<label class="form_label w50b checkbox"><input type="checkbox" name="work_type[]" value="2">计划书沟通</label>
					<label class="form_label w50b checkbox"><input type="checkbox" name="work_type[]" value="3">合同沟通</label>
				</div>
				<div class="form_item_tit"></div>
				<div class="form_item_box">
					<ul class="choice_list">
						跟进方式<li class="tz_li select_li">
							<select id="type1" name="type1">
								<foreach name="follow_type" item="vo">
									<option value="{$vo['id']}">{$vo['name']}</option>
								</foreach>
							</select>
							<input type="hidden" class="vinp">
							<div class="fix_inp">
								<input type="text" class="other" name="type1_other">
								<a class="close first_close" href="javascript:;"></a>
							</div>
						</li>
						项目阶段<li class="tz_li select_li">
                            <select id="type2" name="type2">
								<foreach name="status" item="vo">
									<option value="{$vo['id']}" <if condition="$stage eq $vo['id']">selected</if>>{$vo['name']}</option>
								</foreach>
                            </select>
                            <input type="hidden" class="vinp">
                            <div class="fix_inp">
                                <input type="text" class="other" name="type2_other">
                                <a class="close" href="javascript:;"></a>
                            </div>
                        </li>
						联系人<li class="tz_li select_li">
                            <select id="type3" name="type3">
								<option value="-10">--请选择联系人--</option>
								<foreach name="contact" item="vo">
									<option value="{$vo['contact_id']}">{$vo['username']}</option>
								</foreach>
                            </select>
                            <input type="hidden" class="vinp">
                            <div class="fix_inp">
                                <input type="text" class="other" name="type3_other">
                                <a class="close" href="javascript:;"></a>
                            </div>
                        </li>
					</ul>
				</div>
                <div class="form_item_tit"></div>
                <div class="form_item_box label_box">
                    <div class="form_sub_tit">
                        商务机会
                    </div>
                    <label class="form_label w30b radio"><input type="radio" name="work_chance" value="1">顺利</label>
					<label class="form_label w30b radio active"><input type="radio" name="work_chance" value="2">一般</label>
					<label class="form_label w30b radio"><input type="radio" name="work_chance" value="3">困难</label>
					<label class="form_label w30b radio"><input type="radio" name="work_chance" value="4">不确定</label>
                    <div class="form_label_line"></div>
                    <div class="form_sub_tit">
                        工作备忘录
                    </div>
                    <div class="form_textarea">
                        <input name="remark" type="hidden"><p></p>
                    </div>
                </div>
            </div>
            <div class="build_btn paddbox"><div><button type="button" class="sub_btn disabled" disabled>提 交</button></div></div>
            </form>
        </form>
    </div>
</div>
<!-- 弹出框 -->
<div class="Alert operate_alert">
    <div>
        <p class="operate_label_name"><span>工作备忘录</span></p>
        <textarea name="hb_text"></textarea>
        <div class="btn_box clearboth">
            <a class="btn_close float_l" href="javascript:;">取消</a><button class="btn_alert float_r">确定</button>
        </div>
        <input class="size_input" type="hidden" sid="" tid="">
    </div>
</div>
<include file="Include:javascript" />
<script src="__PUBLIC__/mobile/js/mobiscroll.min.js"></script>
<script>
    $(function(){
        menu_new();
		$('#type1').mobiscroll().select({
            theme: 'ios',
            lang: 'zh',
            display: 'bottom'
        });
		$('#type2').mobiscroll().select({
            theme: 'ios',
            lang: 'zh',
            display: 'bottom'
        });
		$('#type3').mobiscroll().select({
            theme: 'ios',
            lang: 'zh',
            display: 'bottom'
        });
        $(".form_textarea p").click(function(){
            var txt = $(this).text(),
                other = $('.Alert').fadeIn().find('textarea');
            Mask();
            other.focus().html(txt).val(txt);
            if(other.val!=""){
                other.removeClass("disabled").attr('disabled',false);
            }
        })
        //文本域编辑
        $('.btn_close').click(function(){
            $(this).parents('.Alert').find('textarea').html('').val('');
        })
        $('.btn_alert').click(function(){
            var val = $(this).parents('.Alert').find('textarea').val();
            $(".form_textarea p").html(val);
            $("[name='remark']").val(val);
            $('.Mask').fadeOut(function(){
                $(this).remove();
            });
            $(this).parents('.Alert').fadeOut();
            submit();
        })
        $("label").click(function(){
            submit();
        })
		$("[name='type3']").change(function(){
            submit();
        })
		$("[name='type2']").change(function(){
            submit();
        })
		$("[name='type1']").change(function(){
            submit();
        })
        $("[name='visit_date']").change(function(){
            submit();
        })
        //日历
        $('#data').mobiscroll().date({
            theme: 'ios',
            lang: 'zh',
            display: 'bottom'
        });
        //提交验证
        function submit(){
            var tag = true;
			$('.select_li').each(function(){
				if($(this).find('select').val()==-10 || $(this).find('select').val()==0){
					tag = false;
					$('.sub_btn').addClass('disabled').attr('disabled',true);
				}
			})
            if($("[name='visit_date']").val()=='拜访日期'){
                tag = false;
                $('.sub_btn').addClass('disabled').attr('disabled',true);
            }
            if($("[name='work_chance']:checked").length==0){
                tag = false;
                $('.sub_btn').addClass('disabled').attr('disabled',true);
            }
            if(tag){
                $('.sub_btn').removeClass('disabled').attr('disabled',false);
            }
        }
		
		$(".sub_btn").click(function(){
            var follow_add = 'follow_add',
                pid = "{$project['project_id']}";
            $.ajax({
                type:"POST",
                async:false,
                dataType:"json",
                data:$("[name='number_validate']").serialize()+"&action="+follow_add+"&pid="+pid,
                url:"__APP__/Mobile/Crm/stage_ajax",
                success:function(data){
                    success_pop(data.status,data.msg,1,'__APP__/Mobile/Crm/project_situation/id/'+"{$project['project_id']}");
                }
            });
        })
		
    })
</script>
</body>
</html>